'use strict';
const dayjs = require("dayjs");
const {getDefaultModelConfig} = require("../../utils/common");

module.exports = app => {
    const { STRING, INTEGER, DATE, TINYINT } = app.Sequelize;
    return app.model.define(
        'Car',
        {
            id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            license_plate: {type: STRING(20), unique: true, comment: '车牌号'},
            driver_name: {type: STRING(50), comment: '驾驶员姓名'},
            driver_phone: {type: STRING(20), comment: '驾驶员手机号'},
            status: {type: TINYINT, defaultValue: 1, comment: '状态：1-正常，0-删除'},
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'car',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );
};
